-
Notifications
You must be signed in to change notification settings - Fork 53
Add specific logging categories for Worker.Grpc and orchestration logs with backward-compatible opt-in #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: YunchuWang <[email protected]>
…duplicates Co-authored-by: YunchuWang <[email protected]>
|
@copilot update pr description to follow .github/PULL_REQUEST_TEMPLATE.md |
Co-authored-by: YunchuWang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a test failure where dual-category logging (introduced in PR #551) caused duplicate log entries. The issue occurred because TestLogProvider.TryGetLogs() uses StartsWith matching, so querying for Microsoft.DurableTask matched both the legacy category and the new Microsoft.DurableTask.Worker.Grpc category, counting each log message twice.
Key Changes:
- Updated test log queries to use the specific
Microsoft.DurableTask.Worker.Grpccategory instead of the legacy prefix to avoid duplicate matching - Added comprehensive unit tests for the dual-category logging feature
- Introduced logging configuration options to control legacy category emission
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/Worker/Grpc/DualCategoryLogger.cs |
New internal logger wrapper that emits logs to both primary and legacy categories for backward compatibility |
src/Worker/Grpc/GrpcDurableTaskWorker.cs |
Updated to use the new CreateLogger method that creates a dual-category logger when legacy categories are enabled |
src/Worker/Core/DurableTaskWorkerOptions.cs |
Added LoggingOptions class with UseLegacyCategories property to control dual-category logging behavior (defaults to true for backward compatibility) |
test/Worker/Grpc.Tests/LoggingCategoryTests.cs |
New comprehensive test suite for dual-category logging functionality with helper classes for test infrastructure |
test/Worker/Grpc.Tests/RunBackgroundTaskLoggingTests.cs |
Updated category constant to use the specific gRPC category to avoid duplicate log matching |
test/Grpc.IntegrationTests/IntegrationTestBase.cs |
Updated GetLogs() method to query the specific Microsoft.DurableTask.Worker.Grpc category with detailed comments explaining the fix |
|
@copilot no this pr changes include all the changes and fix both, update description to reflect actual changes, it is not just a fix pr |
|
@copilot address all comments |
Co-authored-by: YunchuWang <[email protected]>
Updated PR description to reflect the full dual-category logging feature including:
See commit b2b04ee. |
…lection Co-authored-by: YunchuWang <[email protected]>
Addressed all comments in commit dadaee9:
|
Co-authored-by: YunchuWang <[email protected]>
Co-authored-by: cgillum <[email protected]>
Summary
What changed?
Microsoft.DurableTask.Worker.Grpc(previouslyMicrosoft.DurableTask)DualCategoryLoggerclass that emits logs to both new specific categories and legacyMicrosoft.DurableTaskwhenUseLegacyCategoriesis trueDurableTaskWorkerOptions.Logging.UseLegacyCategoriesconfiguration option (default:true) for backward compatibilityIntegrationTestBase.GetLogs()to use the specific category to avoid duplicate matching when dual-category logging is enabledCompositeDisposable.Dispose()to ensure both disposables are cleaned up even if one throwsWhy is this change needed?
The current logger category assignments are overly broad. Logs related to work item processing and gRPC are under the generic
Microsoft.DurableTaskcategory, making them hard to filter. This change introduces more specific categories while maintaining backward compatibility through dual-emission logging.Issues / work items
Project checklist
UseLegacyCategories = falsestops emitting toMicrosoft.DurableTaskcategoryAI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
src/Worker/Core/DurableTaskWorkerOptions.cs(LoggingOptions class)src/Worker/Grpc/DualCategoryLogger.cs(new file)src/Worker/Grpc/GrpcDurableTaskWorker.cs(CreateLogger method)test/Grpc.IntegrationTests/IntegrationTestBase.cstest/Worker/Grpc.Tests/LoggingCategoryTests.cs(new file)test/Worker/Grpc.Tests/RunBackgroundTaskLoggingTests.csAI verification (required if AI was used):
Testing
Automated tests
Manual validation (only if runtime/behavior changed)
Notes for reviewers
DualCategoryLoggerensures backward compatibility by emitting to both the new specific category and the legacyMicrosoft.DurableTaskcategory whenUseLegacyCategoriesis true (default)CreateWorkerWithLoggingOptionsandGetWorkerLogger) to verify the actual worker logger typeOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.